<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:composite="http://java.sun.com/jsf/composite"
	xmlns:form_composites="http://java.sun.com/jsf/composite/form_composites"
	xmlns:p="http://primefaces.org/ui">
<h:head></h:head>

<composite:interface>
</composite:interface>

<composite:implementation>
	<h:body>
		<form_composites:searchForm beanToUse="#{ldapTreeBean}"
			componentsToUpdate=":#{p:component('ldapTree')}, :#{p:component('searchText')}"
			searchIdField="searchText" />
		<h:form>
			<p:contextMenu for="ldapTree">
				<p:menuitem value="Refresh tree" nodeType="root"
					actionListener="#{ldapTreeBean.refresh()}"
					update=":#{p:component('ldapTree')}" icon="ui-icon-refresh">
				</p:menuitem>
				<p:menuitem value="Expand all" nodeType="root"
					actionListener="#{ldapTreeBean.expandAll()}"
					update=":#{p:component('ldapTree')}"
					icon="ui-icon-circlesmall-minus">
				</p:menuitem>
				<p:menuitem value="Create OU"
					update="#{viewBeanBucket.getUpdateString()}"
					icon="ui-icon-folder-collapsed">
					<f:setPropertyActionListener value="true"
						target="#{createOUBean.show}" />
				</p:menuitem>
			</p:contextMenu>
			<p:contextMenu nodeType="container" for="ldapTree">
				<p:menuitem value="Create User"
					update="#{viewBeanBucket.getUpdateString()}" icon="ui-icon-person">
					<f:setPropertyActionListener value="true"
						target="#{createUserBean.show}" />
				</p:menuitem>
				<p:menuitem value="Create Group"
					update="#{viewBeanBucket.getUpdateString()}" icon="ui-icon-shuffle">
					<f:setPropertyActionListener value="true"
						target="#{createGroupBean.show}" />
				</p:menuitem>
				<p:menuitem value="Create OU"
					update="#{viewBeanBucket.getUpdateString()}"
					icon="ui-icon-folder-collapsed">
					<f:setPropertyActionListener value="true"
						target="#{createOUBean.show}" />
				</p:menuitem>
				<p:menuitem value="Edit OU"
					update="#{viewBeanBucket.getUpdateString()}"
					icon="ui-icon-folder-collapsed">
					<f:setPropertyActionListener value="true"
						target="#{editOUBean.show}" />
				</p:menuitem>
				<p:menuitem value="Delete" appendToBody="true" icon="ui-icon-close"
					onclick="confirmation.show()">
				</p:menuitem>
			</p:contextMenu>
			<p:contextMenu nodeType="group" for="ldapTree">
				<p:menuitem value="Edit Group"
					update="#{viewBeanBucket.getUpdateString()}" icon="ui-icon-shuffle">
					<f:setPropertyActionListener value="true"
						target="#{editGroupBean.show}" />
				</p:menuitem>
				<p:menuitem value="Delete" appendToBody="true" icon="ui-icon-close"
					onclick="confirmation.show()">
				</p:menuitem>
			</p:contextMenu>
			<p:contextMenu nodeType="user" for="ldapTree">
				<p:menuitem value="Edit User"
					update="#{viewBeanBucket.getUpdateString()}" icon="ui-icon-person">
					<f:setPropertyActionListener value="true"
						target="#{editUserBean.show}" />
				</p:menuitem>
				<p:menuitem value="Delete" appendToBody="true" icon="ui-icon-close"
					onclick="confirmation.show()">
				</p:menuitem>
			</p:contextMenu>
			<p:tree style="width: auto" id="ldapTree" dynamic="true"
				selection="#{ldapTreeBean.selectedNode}" selectionMode="single"
				value="#{ldapTreeBean.root}" var="node">

				<p:ajax event="select" update="#{viewBeanBucket.getUpdateString()}"
					listener="#{ldapTreeBean.onNodeSelect}" />
				<p:ajax event="expand" listener="#{ldapTreeBean.onNodeExpand}" />

				<p:treeNode type="default" icon="ui-icon-document">
					<h:outputText value="#{node.cn}" />
				</p:treeNode>
				<p:treeNode type="root" expandedIcon="ui-icon-folder-open"
					collapsedIcon="ui-icon-folder-collapsed">
					<h:outputText value="#{node.cn}" />
				</p:treeNode>
				<p:treeNode icon="ui-icon-shuffle" type="group">
					<h:outputText value="#{node.cn}" />
				</p:treeNode>
				<p:treeNode type="user" icon="ui-icon-person">
					<h:outputText value="#{node.cn}" />
				</p:treeNode>
				<p:treeNode type="ldapObject">
					<h:outputText value="#{node.cn}" />
				</p:treeNode>
				<p:treeNode type="container" expandedIcon="ui-icon-folder-open"
					collapsedIcon="ui-icon-folder-collapsed">
					<h:outputText value="#{node.cn}" />
				</p:treeNode>
				<p:treeNode type="domainController" icon="ui-icon-home">
					<h:outputText value="#{node.cn}" />
				</p:treeNode>
			</p:tree>
		</h:form>
	</h:body>
</composite:implementation>
</html>